package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.SettingInfo;
import cn.liyicun.cp.cpweb.entity.SettingInfoExample;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface SettingInfoMapper extends Serializable {
    @SelectProvider(type=SettingInfoSqlProvider.class, method="countByExample")
    long countByExample(SettingInfoExample example);

    @DeleteProvider(type=SettingInfoSqlProvider.class, method="deleteByExample")
    int deleteByExample(SettingInfoExample example);

    @Delete({
        "delete from setting_info",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into setting_info (team_id, team_key, ",
        "team_value)",
        "values (#{teamId,jdbcType=VARCHAR}, #{teamKey,jdbcType=VARCHAR}, ",
        "#{teamValue,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(SettingInfo record);

    @InsertProvider(type=SettingInfoSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(SettingInfo record);

    @SelectProvider(type=SettingInfoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="team_id", property="teamId", jdbcType=JdbcType.VARCHAR),
        @Result(column="team_key", property="teamKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="team_value", property="teamValue", jdbcType=JdbcType.VARCHAR)
    })
    List<SettingInfo> selectByExampleWithRowbounds(SettingInfoExample example, RowBounds rowBounds);

    @SelectProvider(type=SettingInfoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="team_id", property="teamId", jdbcType=JdbcType.VARCHAR),
        @Result(column="team_key", property="teamKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="team_value", property="teamValue", jdbcType=JdbcType.VARCHAR)
    })
    List<SettingInfo> selectByExample(SettingInfoExample example);

    @Select({
        "select",
        "id, team_id, team_key, team_value",
        "from setting_info",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="team_id", property="teamId", jdbcType=JdbcType.VARCHAR),
        @Result(column="team_key", property="teamKey", jdbcType=JdbcType.VARCHAR),
        @Result(column="team_value", property="teamValue", jdbcType=JdbcType.VARCHAR)
    })
    SettingInfo selectByPrimaryKey(Long id);

    @UpdateProvider(type=SettingInfoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SettingInfo record, @Param("example") SettingInfoExample example);

    @UpdateProvider(type=SettingInfoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SettingInfo record, @Param("example") SettingInfoExample example);

    @UpdateProvider(type=SettingInfoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SettingInfo record);

    @Update({
        "update setting_info",
        "set team_id = #{teamId,jdbcType=VARCHAR},",
          "team_key = #{teamKey,jdbcType=VARCHAR},",
          "team_value = #{teamValue,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SettingInfo record);
}